package com.yeban.javase.day02.test05;

import java.util.concurrent.TimeUnit;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/10
 */
public class Test {

    public static void main(String[] args) throws InterruptedException {

        Equip e1 = new Equip("铁剑", 1, "白色", "普通", 10, 5);
        Equip e2 = new Equip("村好剑", 3, "紫色", "史诗", 50, 10);
        Equip e3 = new Equip("流星锤", 4, "紫色", "史诗", 30, 30);
        Equip e4 = new Equip("魔杖", 4, "紫色", "史诗", 60, 5);

        Hero hero = new Hero("皮特", 15, 200, 10, 10, "人族");
        hero.addEquip(e1);
        hero.addEquip(e2);
        hero.addEquip(e3);
        hero.addEquip(e4);

        Monster monster = new Monster("史莱姆大王", 15, 2500, 30, 20, "魔族");

        boolean flag = true;
        int count = 0;
        while(flag) {
            System.out.println("==========第" + (++ count) + "回合==========");
            if(hero.isDead() || monster.isDead()) {
                flag = false;
            } else {
                hero.attack(monster);
                //线程沉睡
                TimeUnit.MILLISECONDS.sleep(700);

                monster.attack(hero);
                //线程沉睡
                TimeUnit.MILLISECONDS.sleep(700);
            }

        }

    }
}
